<%@ page pageEncoding='UTF-8'%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:set var="contextPath" value="#request.get('javax.servlet.forward.context_path')" scope="request" />

<s:if test="%{existDayAppointmentMap}">
	<legend class="text-center">Day Appointments List</legend>
	<jsp:include page="/WEB-INF/content/appointment/AppointmentDateSelector.jsp" flush="true"/>
	<br/>
	<s:iterator var="sHour" value="%{dayAppointmentMap}" status="hourStatus">
		<div class='hour-info-container <s:if test="#hourStatus.odd == true">odd</s:if><s:else>even</s:else>'>
			<div class="hour-container place-left"><h1 class="hour">${sHour.key}</h1></div>
			<div class="minute-info-container place-left">
				<s:iterator var="sMinute" value="%{#sHour.value}" status="minuteStatus">
					<div class="minute-container">
						<h2 class="minute place-left">${sMinute.key}</h2>
						<div class="patient-list-container subheader-secondary place-left">
	                    	<s:if test="%{#sMinute.value != null}">
	                        	<div class="patient-container">
	                            	<s:set var="appointment" value="%{#sMinute.value}" />
									<label class="patient place-left" title="${appointment.patient.name}" alt="${appointment.time}">
	                                	<a href="${contextPath}/patient/show?id=${appointment.patient.userId}">${appointment.patient.name}</a>
	                                </label>
	                                <s:if test="%{todayOrFutureAppointmentDateTime}">
										<span class="appointment-btn-contaner place-right">
											<a href="${contextPath}/appointment/edit?id=${appointment.appointmentId}&aptDate=${appointment.date}" class="apt-edit-btn"><i class="icon-pencil bg-gray fg-white"></i></a>
											<a href="${contextPath}/appointment/delete?id=${appointment.appointmentId}" class="apt-delete-btn"><i class="icon-remove bg-red fg-white"></i></a>
										</span>
	                                </s:if>
								</div>
	                        </s:if>
	                        <s:else>
	                        	<s:if test="%{todayOrFutureAppointmentDateTime}">
		                        	<span class="appointment-btn-contaner place-right">
		                        		<a href="${contextPath}/appointment/registration?aptDate=${aptDate}&aptTime=${sHour.key}:${sMinute.key}" class="apt-registration-btn">
			                        		<i class="icon-plus-2 bg-lightBlue fg-white"></i>
			                        	</a>
		                        	</span>
	                        	</s:if>
	                        </s:else>
						</div>
						<br clear="all"/>
					</div>
				</s:iterator>
			</div>
			<br clear="all"/>
		</div>
	</s:iterator>
</s:if>